namespace PortalWeb.Quartz.Dao.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class Quartz : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.tb_category_model",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        CategoryName = c.String(),
                        CategoryCreateTime = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.tb_command_model",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Command = c.String(),
                        CommandName = c.String(),
                        Commandstate = c.Byte(nullable: false),
                        TaskId = c.Int(nullable: false),
                        NodeId = c.Int(nullable: false),
                        CommandCreateTime = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.tb_error_model",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Msg = c.String(),
                        ErrorType = c.Byte(nullable: false),
                        ErrorCreateTime = c.DateTime(nullable: false),
                        TaskId = c.Int(nullable: false),
                        NodeId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.tb_log_model",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Msg = c.String(),
                        LogType = c.Byte(nullable: false),
                        LogCreateTime = c.DateTime(nullable: false),
                        TaskId = c.Int(nullable: false),
                        NodeId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.tb_node_model",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        NodeName = c.String(),
                        NodeCreateTime = c.DateTime(nullable: false),
                        Nodeip = c.String(),
                        NodeLastUpdateTime = c.DateTime(nullable: false),
                        IfCheckState = c.Boolean(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.tb_performance_model",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        NodeId = c.Int(nullable: false),
                        TaskId = c.Int(nullable: false),
                        Cpu = c.Double(nullable: false),
                        Memory = c.Double(nullable: false),
                        InstallDirsize = c.Double(nullable: false),
                        LastUpdateTime = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.tb_task_model",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        TaskName = c.String(),
                        CategoryId = c.Int(nullable: false),
                        NodeId = c.Int(nullable: false),
                        TaskCreateTime = c.DateTime(nullable: false),
                        TaskUpdatetTime = c.DateTime(nullable: false),
                        TaskLastStartTime = c.DateTime(nullable: false),
                        TaskLastEndTime = c.DateTime(nullable: false),
                        TaskLastErrorTime = c.DateTime(nullable: false),
                        TaskErrorCount = c.Int(nullable: false),
                        TaskRunCount = c.Int(nullable: false),
                        TaskCreateUserId = c.Int(nullable: false),
                        TaskState = c.Byte(nullable: false),
                        TaskVersion = c.Int(nullable: false),
                        TaskAppconfigJson = c.String(),
                        TaskCron = c.String(),
                        TaskMainClassdllfileName = c.String(),
                        TaskMainClassNamespace = c.String(),
                        TaskRemark = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.tb_tempdata_model",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        TaskId = c.Int(nullable: false),
                        TempdataJson = c.String(),
                        TempdataLastUpdateTime = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.tb_version_model",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        TaskId = c.Int(nullable: false),
                        Version = c.Int(nullable: false),
                        VersionCreateTime = c.DateTime(nullable: false),
                        ZipFile = c.Binary(),
                        ZipFileName = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
        }
        
        public override void Down()
        {
            DropTable("dbo.tb_version_model");
            DropTable("dbo.tb_tempdata_model");
            DropTable("dbo.tb_task_model");
            DropTable("dbo.tb_performance_model");
            DropTable("dbo.tb_node_model");
            DropTable("dbo.tb_log_model");
            DropTable("dbo.tb_error_model");
            DropTable("dbo.tb_command_model");
            DropTable("dbo.tb_category_model");
        }
    }
}
